package com.xiaojimao.Controller;

import com.xaiojimao.gr_common.dto.Result;
import com.xiaojimao.Minio.MinioService;
import com.xiaojimao.Service.SensitiveWordsService;
import com.xiaojimao.Utils.OCRUtil;
import com.xiaojimao.Vo.SensitiveRequestParams;
import com.xiaojimao.Vo.SensitiveVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;

@RestController
@RequestMapping("/article/upload")
public class ArticleUpLoadController {
    @Autowired
    MinioService minioService;

    @Autowired
    OCRUtil ocrUtil;

    @Autowired
    SensitiveWordsService sensitiveWordsService;

    /**
     * 上传图片到minio
     * @param file
     * @return
     */
    @PostMapping
    public Result upLoadFile(MultipartFile file) {
        String url = minioService.uploadFile(file, "articleImage");
        String path = new HashMap<String, String>().put("path", url);
        return Result.success(path);
    }


}
